﻿using System.Windows;
using System.Windows.Controls;

namespace VMWareLabWorkflowsDataContracts.VMWareLabDetailsDialogControls
{
    using System.ComponentModel;

    /// <summary>
    /// Interaction logic for NavigationControl.xaml
    /// </summary>
    public partial class NavigationControl : UserControl
    {     
        public event SelectionChangedEventHandler OnSelectionChanged;

        private void SelectionChanged(object sender, RoutedEventArgs e)
        {
            if (OnSelectionChanged != null)
                OnSelectionChanged(sender, null);
        }        

        public NavigationControl()
        {
            InitializeComponent();
            VMWareWizardData.VMWareWizzardDataInstance.PropertyChanged += this.SelectNavigationItem;
        }

        private void SelectNavigationItem(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName.Equals("CurrentControlName"))
            {
                switch (VMWareWizardData.VMWareWizzardDataInstance.CurrentControlName)
                {
                    case "Welcome":
                        this.Welcome.IsChecked = true;
                        break;
                    case "Environment":
                        this.Environment.IsChecked = true;
                        break;
                    case "Build":
                        this.Build.IsChecked = true;
                        break;
                    case "Deploy":
                        this.Deploy.IsChecked = true;
                        break;
                    case "Test":
                        this.Test.IsChecked = true;
                        break;
                }
            }
            
        }
    }
}
